package cn.pconline.autoclub.service.ucsysnc;

import org.springframework.beans.factory.annotation.Autowired;

import cn.pconline.autoclub.entity.User;
import cn.pconline.autoclub.mq.AbstractMessageHandler;
import cn.pconline.autoclub.service.UserService;

import com.alibaba.fastjson.JSONObject;

/**
 *
 * @author ppc
 */
public class SyncNickNameService extends AbstractMessageHandler{
    @Autowired
    private UserService userService;
    @Override
    public void handleJsonMessage(JSONObject object) {
        long userId = object.getLong("userId");
        User user =  userService.findUser(userId);
        if(user!=null){
           user.setNickname(object.getString("nickName")); 
           userService.updateUser(user);
        }
    }
}
